package com.bw.day04zh

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.blankj.utilcode.util.ToastUtils
import com.bw.base.mvvm.BaseActivity
import com.bw.day04zh.databinding.ActivityMainBinding

class MainActivity : BaseActivity<ActivityMainBinding,MainViewModel>() {
    override fun initView() {
        binding.btn.setOnClickListener {
            viewModel.codeSend(binding.et.text.toString())
        }
    }

    override fun initData() {
        viewModel.success.observe(this){
            ToastUtils.showLong(it.message)
        }
        viewModel.fail.observe(this){
            ToastUtils.showLong(it)
        }
    }

    override fun getViewModel(): Class<MainViewModel> =MainViewModel::class.java

    override fun getLayout(): Int = R.layout.activity_main

}